Use @Catch() with no argument to intercept all exceptions including ORM errors. Branch on the exception type to map specific ORM error codes to semantic HTTP status codes — EntityNotFoundError to 404, unique constraint violations (code 23505) to 409, foreign key violations (code 23503) to 400. Log unknown DB errors server-side and return a generic 500.
EntityNotFoundError (TypeORM) — map to 404 Not Found.
QueryFailedError code 23505 (Postgres unique violation) — map to 409 Conflict.
QueryFailedError code 23503 (Postgres foreign key violation) — map to 400 Bad Request.
QueryFailedError code 23502 (Postgres not null violation) — map to 400 Bad Request.
Always log unexpected database errors with the full stack — never silently swallow them.